<!--
  ~ Copyright (c) 2016.  hangzhou BOYE .Co.Ltd. All rights reserved
  -->
{extend name="learun/template/base_inner" /}


{block name="area_header"}

{/block}

{block name="area_body"}
	<div class="admin-main container-fluid">
		<div class="admin-main-content">
			欢迎您使用本系统
			<div style="display:none;">
				<h3>后台二维码入口</h3>
				<div class="col-lg-5 col-md-6">
					<div><a href="javascript:void(0);" onclick="refreshQrcode();" class="btn btn-primary btn-xs"><i class="fa fa-refresh"></i>重新生成</a></div>
					<h5>
						<input  value="{$admin_url}/admin.php/admin/index/login#/home" class="j_qrcode_text form-control"  /> </h5>
					<div id="qrcode"></div>
				</div>

			</div>
		</div>

	</div>
{/block}

{block name="area_footer"}
	<script type="text/javascript" src="__CDN__/jquery-qrcode/v1.0/jquery.qrcode.min.js"></script>
	<script type="text/javascript">
		function refreshQrcode() {
		    $text = $(".j_qrcode_text").val();
            $("#qrcode").empty();
            $("#qrcode").qrcode(toUtf8($text));
        }
        function toUtf8(str) {
            var out, i, len, c;
            out = "";
            len = str.length;
            for(i = 0; i < len; i++) {
                c = str.charCodeAt(i);
                if ((c >= 0x0001) && (c <= 0x007F)) {
                    out += str.charAt(i);
                } else if (c > 0x07FF) {
                    out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));
                    out += String.fromCharCode(0x80 | ((c >>  6) & 0x3F));
                    out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));
                } else {
                    out += String.fromCharCode(0xC0 | ((c >>  6) & 0x1F));
                    out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));
                }
            }
            return out;
        }
        $(function () {
            $("#qrcode").qrcode("{$admin_url}");
        })
	</script>
{/block}